fix: use Z suffix for UTC timestamps and omit null trace_id#4
Merged
Polliog merged 1 commit intologtide-dev:mainfrom Apr 5, 2026
Merged
Conversation
- LogEntry.__post_init__: use strftime with Z suffix instead of isoformat() which produces +00:00. The server's Zod schema (z.string().datetime()) only accepts the Z suffix. - Normalize caller-supplied +00:00 offset to Z as well. - LogEntry.to_dict(): only include trace_id when it is not None. The server's Zod schema (z.string().optional()) rejects null; only undefined (omitted) or a string value are valid.
c9e1d15 to
e0f4964
Compare
Contributor
|
Hi thank you for the changes, I will merge this and release a new version of the package |
Contributor
Author
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Python SDK produces payloads that the LogTide server rejects with HTTP 400 (Validation error). Two issues in
LogEntry:timeuses+00:00instead ofZ—datetime.now(timezone.utc).isoformat()produces2026-04-05T08:00:00.123456+00:00, but the server's Zod schema (z.string().datetime()) only acceptsZ. The JS SDK usesnew Date().toISOString()which always producesZ.trace_idserialized asnull—to_dict()always includestrace_id. WhenNone, JSON produces"trace_id": null, but the server's Zod schema (z.string().optional()) rejectsnull— only omitted or string are valid. The JS SDK uses optional chaining (scope?.traceId) →undefined→ omitted byJSON.stringify.Changes
LogEntry.__post_init__: usestrftime("%Y-%m-%dT%H:%M:%S.%fZ")instead of.isoformat()LogEntry.__post_init__: normalize caller-supplied+00:00offset toZLogEntry.to_dict(): omittrace_idfrom payload when it isNoneinstead of serializing it asnullTest plan